#!/bin/bash
# ***************************************************************
# *                    simula+@metz.ensam.fr                    *
# *	              GNU/linux version 0.1.0                   *
# *            software under General Public License            *
# ***************************************************************
# * copyright  2003,2004,2005,2006 CREUSE Emmanuel
# * copyright  Laboratoire de Physique et Mcanique des Matriaux (LPMM - UMR 7554)
# * copyright  Laboratoire de Mathmatiques et ses Applications de Valenciennes (LAMAV - EA 4015)
# ***************************************************************/

#    run FEMOL++ belongs to Finite Element Method Object Libraries (FEMOL++) </br>
#    FEMOL++ is part of Simula+ <br><br>
#
#    Simula+ is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version. <br><br>
#
#    Simula+ is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details. <br><br>
#
#    You should have received a copy of the GNU General Public License
#    along with Simula+; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

compiler=$(which icc |grep icc)
if [ "$compiler" = "" ]; then
   compiler=$(which g++ |grep g++)
   if [ "$compiler" = "" ]; then
      echo no compiler found
      exit
    fi
fi

cd FEMOL++
if [ -f femol++.exe ]; then 
    rm femol++.exe
fi
$compiler -w -o femol++.exe tests-FEMOL++.cpp
if [ -f femol++.exe ]; then 
     ./femol++.exe
     rm femol++.exe
     rm *.res
else if [ -f ../simula+.old ]; then
        mv -f ../simula+.old ../simula+.bak
     fi
fi
cd ..

